.class public Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;
.super Ljava/lang/Object;
.source "StabilizedMediaRecorder.java"

# interfaces
.implements Lcom/instagram/creation/video/mediarecorder/f;


# static fields
.field private static final a:[B

.field private static final b:[B


# instance fields
.field private c:I

.field private d:Landroid/view/Surface;

.field private e:Ljava/lang/String;

.field private f:Ljava/io/FileDescriptor;

.field private g:Ljava/io/FileOutputStream;

.field private h:Lcom/instagram/creation/video/mediarecorder/t;

.field private i:Lcom/instagram/creation/video/mediarecorder/g;

.field private j:Lcom/instagram/creation/video/mediarecorder/h;

.field private k:Landroid/hardware/SensorManager;

.field private l:Landroid/hardware/Sensor;

.field private m:Lcom/instagram/creation/video/mediarecorder/e;

.field private n:Lcom/instagram/creation/video/mediarecorder/d;

.field private o:Landroid/os/HandlerThread;

.field private p:Landroid/os/Handler;

.field private q:Landroid/content/Context;

.field private r:Lcom/instagram/creation/video/mediarecorder/m;


# direct methods
.method static constructor <clinit>()V
    .locals 2

    .prologue
    const/4 v1, 0x4

    .line 84
    new-array v0, v1, [B

    fill-array-data v0, :array_0

    sput-object v0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->a:[B

    .line 85
    new-array v0, v1, [B

    fill-array-data v0, :array_1

    sput-object v0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->b:[B

    .line 88
    const-string v0, "mediarecorder"

    invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

    .line 89
    const-string v0, "mediarecorder_jni"

    invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

    .line 90
    invoke-static {}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->native_init()V

    .line 91
    return-void

    .line 84
    nop

    :array_0
    .array-data 0x1
        0x69t
        0x6et
        0x66t
        0x6ft
    .end array-data

    .line 85
    :array_1
    .array-data 0x1
        0x4dt
        0x4et
        0x4ft
        0x58t
    .end array-data
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 2
    .parameter "mContext"

    .prologue
    .line 125
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 128
    invoke-static {}, Landroid/os/Looper;->myLooper()Landroid/os/Looper;

    move-result-object v0

    if-eqz v0, :cond_0

    .line 129
    new-instance v1, Lcom/instagram/creation/video/mediarecorder/t;

    invoke-direct {v1, p0, p0, v0}, Lcom/instagram/creation/video/mediarecorder/t;-><init>(Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;Landroid/os/Looper;)V

    iput-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->h:Lcom/instagram/creation/video/mediarecorder/t;

    .line 139
    :goto_0
    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p0}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    invoke-direct {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->native_setup(Ljava/lang/Object;)V

    .line 141
    iput-object p1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->q:Landroid/content/Context;

    .line 142
    return-void

    .line 130
    :cond_0
    invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;

    move-result-object v0

    if-eqz v0, :cond_1

    .line 131
    new-instance v1, Lcom/instagram/creation/video/mediarecorder/t;

    invoke-direct {v1, p0, p0, v0}, Lcom/instagram/creation/video/mediarecorder/t;-><init>(Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;Landroid/os/Looper;)V

    iput-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->h:Lcom/instagram/creation/video/mediarecorder/t;

    goto :goto_0

    .line 133
    :cond_1
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->h:Lcom/instagram/creation/video/mediarecorder/t;

    goto :goto_0
.end method

.method private native _prepare()V
.end method

.method private native _setOutputFile(Ljava/io/FileDescriptor;JJ)V
.end method

.method private native _start()V
.end method

.method static synthetic a(Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;)I
    .locals 1
    .parameter

    .prologue
    .line 80
    iget v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->c:I

    return v0
.end method

.method private a(Z)V
    .locals 2
    .parameter

    .prologue
    .line 1184
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->e:Ljava/lang/String;

    if-eqz v0, :cond_1

    .line 1186
    :try_start_0
    new-instance v0, Ljava/io/FileOutputStream;

    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->e:Ljava/lang/String;

    invoke-direct {v0, v1, p1}, Ljava/io/FileOutputStream;-><init>(Ljava/lang/String;Z)V

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->g:Ljava/io/FileOutputStream;
    :try_end_0
    .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    .line 1194
    :cond_0
    :goto_0
    return-void

    .line 1187
    :catch_0
    move-exception v0

    .line 1188
    const-string v0, "MediaRecorder_IG"

    const-string v1, "failed to reopen video file, not writing more data"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 1191
    :cond_1
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->f:Ljava/io/FileDescriptor;

    if-eqz v0, :cond_0

    .line 1192
    new-instance v0, Ljava/io/FileOutputStream;

    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->f:Ljava/io/FileDescriptor;

    invoke-direct {v0, v1}, Ljava/io/FileOutputStream;-><init>(Ljava/io/FileDescriptor;)V

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->g:Ljava/io/FileOutputStream;

    goto :goto_0
.end method

.method static synthetic b(Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;)Lcom/instagram/creation/video/mediarecorder/g;
    .locals 1
    .parameter

    .prologue
    .line 80
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->i:Lcom/instagram/creation/video/mediarecorder/g;

    return-object v0
.end method

.method static synthetic c(Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;)Lcom/instagram/creation/video/mediarecorder/d;
    .locals 1
    .parameter

    .prologue
    .line 80
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->n:Lcom/instagram/creation/video/mediarecorder/d;

    return-object v0
.end method

.method static synthetic d(Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;)Lcom/instagram/creation/video/mediarecorder/h;
    .locals 1
    .parameter

    .prologue
    .line 80
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->j:Lcom/instagram/creation/video/mediarecorder/h;

    return-object v0
.end method

.method private h()Lorg/json/JSONObject;
    .locals 6

    .prologue
    .line 792
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    .line 793
    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1}, Lorg/json/JSONObject;-><init>()V

    .line 799
    const-string v2, "stabilized"

    const/4 v3, 0x0

    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Z)Lorg/json/JSONObject;

    .line 801
    const-string v2, "ver"

    const-string v3, "1.1"

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 802
    const-string v2, "device"

    sget-object v3, Landroid/os/Build;->MODEL:Ljava/lang/String;

    const-string v4, " "

    const-string v5, "_"

    invoke-virtual {v3, v4, v5}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 803
    const-string v2, "manufacturer"

    sget-object v3, Landroid/os/Build;->MANUFACTURER:Ljava/lang/String;

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 804
    const-string v2, "brand"

    sget-object v3, Landroid/os/Build;->BRAND:Ljava/lang/String;

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 805
    const-string v2, "sysVer"

    sget-object v3, Landroid/os/Build$VERSION;->RELEASE:Ljava/lang/String;

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 806
    const-string v2, "appVer"

    iget-object v3, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->q:Landroid/content/Context;

    invoke-static {v3}, Lcom/instagram/i/a;->c(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 807
    const-string v2, "camera"

    invoke-virtual {v1, v2, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 808
    const-string v0, "MediaRecorder_IG"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "metadata for video:\n"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v1}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 809
    return-object v1
.end method

.method private i()V
    .locals 2

    .prologue
    .line 1177
    :try_start_0
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->g:Ljava/io/FileOutputStream;

    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 1181
    :goto_0
    return-void

    .line 1178
    :catch_0
    move-exception v0

    .line 1179
    const-string v0, "MediaRecorder_IG"

    const-string v1, "IOException while trying to close mVideoFileOutputStream"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method

.method private final native native_finalize()V
.end method

.method private static final native native_init()V
.end method

.method private native native_reset()V
.end method

.method private final native native_setup(Ljava/lang/Object;)V
.end method

.method private native setParameter(Ljava/lang/String;)V
.end method


# virtual methods
.method public native _release()V
.end method

.method public native _stop()V
.end method

.method public a()V
    .locals 6

    .prologue
    const-wide/16 v2, 0x0

    .line 769
    invoke-virtual {p0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->f()V

    .line 770
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->r:Lcom/instagram/creation/video/mediarecorder/m;

    invoke-virtual {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->a(Lcom/instagram/creation/video/mediarecorder/m;)V

    .line 771
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->r:Lcom/instagram/creation/video/mediarecorder/m;

    invoke-virtual {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->b(Lcom/instagram/creation/video/mediarecorder/m;)V

    .line 772
    const/4 v0, 0x0

    invoke-direct {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->a(Z)V

    .line 774
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->e:Ljava/lang/String;

    if-eqz v0, :cond_0

    .line 775
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->g:Ljava/io/FileOutputStream;

    invoke-virtual {v0}, Ljava/io/FileOutputStream;->getFD()Ljava/io/FileDescriptor;

    move-result-object v1

    move-object v0, p0

    move-wide v4, v2

    invoke-direct/range {v0 .. v5}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->_setOutputFile(Ljava/io/FileDescriptor;JJ)V

    .line 783
    :goto_0
    :try_start_0
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->r:Lcom/instagram/creation/video/mediarecorder/m;

    sget-object v1, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->a:[B

    invoke-direct {p0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->h()Lorg/json/JSONObject;

    move-result-object v2

    invoke-static {v0, v1, v2}, Lcom/instagram/creation/video/mediarecorder/m;->a(Lcom/instagram/creation/video/mediarecorder/m;[BLorg/json/JSONObject;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    .line 788
    :goto_1
    invoke-direct {p0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->_prepare()V

    .line 789
    return-void

    .line 776
    :cond_0
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->f:Ljava/io/FileDescriptor;

    if-eqz v0, :cond_1

    .line 777
    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->f:Ljava/io/FileDescriptor;

    move-object v0, p0

    move-wide v4, v2

    invoke-direct/range {v0 .. v5}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->_setOutputFile(Ljava/io/FileDescriptor;JJ)V

    goto :goto_0

    .line 779
    :cond_1
    new-instance v0, Ljava/io/IOException;

    const-string v1, "No valid output file"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 784
    :catch_0
    move-exception v0

    .line 785
    const-string v0, "MediaRecorder_IG"

    const-string v1, "JSON exception, video will not have any meta data!"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_1
.end method

.method public a(I)V
    .locals 2
    .parameter

    .prologue
    .line 651
    if-gtz p1, :cond_0

    .line 652
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Audio sampling rate is not positive"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 654
    :cond_0
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "audio-param-sampling-rate="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->setParameter(Ljava/lang/String;)V

    .line 655
    return-void
.end method

.method public a(Landroid/media/CamcorderProfile;)V
    .locals 2
    .parameter

    .prologue
    .line 440
    iget v0, p1, Landroid/media/CamcorderProfile;->fileFormat:I

    invoke-virtual {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->setOutputFormat(I)V

    .line 441
    iget v0, p1, Landroid/media/CamcorderProfile;->videoFrameRate:I

    invoke-virtual {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->setVideoFrameRate(I)V

    .line 442
    iget v0, p1, Landroid/media/CamcorderProfile;->videoFrameWidth:I

    iget v1, p1, Landroid/media/CamcorderProfile;->videoFrameHeight:I

    invoke-virtual {p0, v0, v1}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->setVideoSize(II)V

    .line 443
    iget v0, p1, Landroid/media/CamcorderProfile;->videoBitRate:I

    invoke-virtual {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->d(I)V

    .line 444
    iget v0, p1, Landroid/media/CamcorderProfile;->videoCodec:I

    invoke-virtual {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->setVideoEncoder(I)V

    .line 445
    iget v0, p1, Landroid/media/CamcorderProfile;->quality:I

    const/16 v1, 0x3e8

    if-lt v0, v1, :cond_0

    iget v0, p1, Landroid/media/CamcorderProfile;->quality:I

    const/16 v1, 0x3ef

    if-gt v0, v1, :cond_0

    .line 455
    :goto_0
    return-void

    .line 450
    :cond_0
    iget v0, p1, Landroid/media/CamcorderProfile;->audioBitRate:I

    invoke-virtual {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->c(I)V

    .line 451
    iget v0, p1, Landroid/media/CamcorderProfile;->audioChannels:I

    invoke-virtual {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->b(I)V

    .line 452
    iget v0, p1, Landroid/media/CamcorderProfile;->audioSampleRate:I

    invoke-virtual {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->a(I)V

    .line 453
    iget v0, p1, Landroid/media/CamcorderProfile;->audioCodec:I

    invoke-virtual {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->setAudioEncoder(I)V

    goto :goto_0
.end method

.method public a(Landroid/view/Surface;)V
    .locals 0
    .parameter

    .prologue
    .line 186
    iput-object p1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->d:Landroid/view/Surface;

    .line 187
    return-void
.end method

.method public a(Lcom/instagram/creation/video/mediarecorder/g;)V
    .locals 0
    .parameter

    .prologue
    .line 938
    iput-object p1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->i:Lcom/instagram/creation/video/mediarecorder/g;

    .line 939
    return-void
.end method

.method public a(Lcom/instagram/creation/video/mediarecorder/h;)V
    .locals 0
    .parameter

    .prologue
    .line 1051
    iput-object p1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->j:Lcom/instagram/creation/video/mediarecorder/h;

    .line 1052
    return-void
.end method

.method public a(Lcom/instagram/creation/video/mediarecorder/m;)V
    .locals 2
    .parameter

    .prologue
    .line 154
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->k:Landroid/hardware/SensorManager;

    const/4 v1, 0x4

    invoke-virtual {v0, v1}, Landroid/hardware/SensorManager;->getDefaultSensor(I)Landroid/hardware/Sensor;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->l:Landroid/hardware/Sensor;

    .line 155
    new-instance v0, Lcom/instagram/creation/video/mediarecorder/e;

    invoke-direct {v0, p1}, Lcom/instagram/creation/video/mediarecorder/e;-><init>(Lcom/instagram/creation/video/mediarecorder/m;)V

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->m:Lcom/instagram/creation/video/mediarecorder/e;

    .line 156
    return-void
.end method

.method public a(Ljava/lang/String;)V
    .locals 1
    .parameter

    .prologue
    .line 748
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->f:Ljava/io/FileDescriptor;

    .line 749
    iput-object p1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->e:Ljava/lang/String;

    .line 750
    return-void
.end method

.method public b()V
    .locals 5

    .prologue
    .line 828
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->k:Landroid/hardware/SensorManager;

    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->m:Lcom/instagram/creation/video/mediarecorder/e;

    iget-object v2, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->l:Landroid/hardware/Sensor;

    const/16 v3, 0x2710

    iget-object v4, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->p:Landroid/os/Handler;

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/hardware/SensorManager;->registerListener(Landroid/hardware/SensorEventListener;Landroid/hardware/Sensor;ILandroid/os/Handler;)Z

    .line 830
    invoke-direct {p0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->_start()V

    .line 831
    return-void
.end method

.method public b(I)V
    .locals 2
    .parameter

    .prologue
    .line 666
    if-gtz p1, :cond_0

    .line 667
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Number of channels is not positive"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 669
    :cond_0
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "audio-param-number-of-channels="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->setParameter(Ljava/lang/String;)V

    .line 670
    return-void
.end method

.method public b(Lcom/instagram/creation/video/mediarecorder/m;)V
    .locals 1
    .parameter

    .prologue
    .line 159
    new-instance v0, Lcom/instagram/creation/video/mediarecorder/d;

    invoke-direct {v0, p1}, Lcom/instagram/creation/video/mediarecorder/d;-><init>(Lcom/instagram/creation/video/mediarecorder/m;)V

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->n:Lcom/instagram/creation/video/mediarecorder/d;

    .line 160
    return-void
.end method

.method public c()V
    .locals 3

    .prologue
    .line 848
    invoke-virtual {p0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->_stop()V

    .line 849
    new-instance v0, Ljava/util/concurrent/CountDownLatch;

    const/4 v1, 0x3

    invoke-direct {v0, v1}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V

    .line 850
    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->k:Landroid/hardware/SensorManager;

    iget-object v2, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->m:Lcom/instagram/creation/video/mediarecorder/e;

    invoke-virtual {v1, v2}, Landroid/hardware/SensorManager;->unregisterListener(Landroid/hardware/SensorEventListener;)V

    .line 851
    const-string v1, "MediaRecorder_IG"

    const-string v2, "unregistered sensor"

    invoke-static {v1, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 860
    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->n:Lcom/instagram/creation/video/mediarecorder/d;

    new-instance v2, Lcom/instagram/creation/video/mediarecorder/q;

    invoke-direct {v2, p0, v0}, Lcom/instagram/creation/video/mediarecorder/q;-><init>(Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;Ljava/util/concurrent/CountDownLatch;)V

    invoke-virtual {v1, v2}, Lcom/instagram/creation/video/mediarecorder/d;->a(Lcom/instagram/creation/video/mediarecorder/o;)V

    .line 866
    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->m:Lcom/instagram/creation/video/mediarecorder/e;

    new-instance v2, Lcom/instagram/creation/video/mediarecorder/r;

    invoke-direct {v2, p0, v0}, Lcom/instagram/creation/video/mediarecorder/r;-><init>(Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;Ljava/util/concurrent/CountDownLatch;)V

    invoke-virtual {v1, v2}, Lcom/instagram/creation/video/mediarecorder/e;->a(Lcom/instagram/creation/video/mediarecorder/o;)V

    .line 872
    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->p:Landroid/os/Handler;

    new-instance v2, Lcom/instagram/creation/video/mediarecorder/s;

    invoke-direct {v2, p0, v0}, Lcom/instagram/creation/video/mediarecorder/s;-><init>(Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;Ljava/util/concurrent/CountDownLatch;)V

    invoke-virtual {v1, v2}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 881
    :try_start_0
    const-string v1, "MediaRecorder_IG"

    const-string v2, "waiting for frame/gyro/merge to finish"

    invoke-static {v1, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 882
    invoke-virtual {v0}, Ljava/util/concurrent/CountDownLatch;->await()V

    .line 883
    const-string v0, "MediaRecorder_IG"

    const-string v1, "everything clean for release!"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    .line 887
    :goto_0
    return-void

    .line 884
    :catch_0
    move-exception v0

    .line 885
    const-string v0, "MediaRecorder_IG"

    const-string v1, "count down latch during release was interrupted"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method

.method public c(I)V
    .locals 2
    .parameter

    .prologue
    .line 682
    if-gtz p1, :cond_0

    .line 683
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Audio encoding bit rate is not positive"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 685
    :cond_0
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "audio-param-encoding-bitrate="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->setParameter(Ljava/lang/String;)V

    .line 686
    return-void
.end method

.method public d()V
    .locals 2

    .prologue
    .line 895
    invoke-direct {p0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->native_reset()V

    .line 898
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->h:Lcom/instagram/creation/video/mediarecorder/t;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/mediarecorder/t;->removeCallbacksAndMessages(Ljava/lang/Object;)V

    .line 899
    return-void
.end method

.method public d(I)V
    .locals 2
    .parameter

    .prologue
    .line 698
    if-gtz p1, :cond_0

    .line 699
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Video encoding bit rate is not positive"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 701
    :cond_0
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "video-param-encoding-bitrate="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->setParameter(Ljava/lang/String;)V

    .line 702
    return-void
.end method

.method public e()V
    .locals 1

    .prologue
    .line 1171
    invoke-virtual {p0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->_release()V

    .line 1172
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->o:Landroid/os/HandlerThread;

    invoke-virtual {v0}, Landroid/os/HandlerThread;->quit()Z

    .line 1173
    return-void
.end method

.method public f()V
    .locals 2

    .prologue
    .line 145
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->q:Landroid/content/Context;

    const-string v1, "sensor"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/hardware/SensorManager;

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->k:Landroid/hardware/SensorManager;

    .line 146
    new-instance v0, Landroid/os/HandlerThread;

    const-string v1, "backgroundDataThread"

    invoke-direct {v0, v1}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->o:Landroid/os/HandlerThread;

    .line 147
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->o:Landroid/os/HandlerThread;

    invoke-virtual {v0}, Landroid/os/HandlerThread;->start()V

    .line 148
    new-instance v0, Landroid/os/Handler;

    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->o:Landroid/os/HandlerThread;

    invoke-virtual {v1}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->p:Landroid/os/Handler;

    .line 150
    new-instance v0, Lcom/instagram/creation/video/mediarecorder/m;

    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->p:Landroid/os/Handler;

    invoke-direct {v0, v1}, Lcom/instagram/creation/video/mediarecorder/m;-><init>(Landroid/os/Handler;)V

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->r:Lcom/instagram/creation/video/mediarecorder/m;

    .line 151
    return-void
.end method

.method protected finalize()V
    .locals 0

    .prologue
    .line 1198
    invoke-direct {p0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->native_finalize()V

    .line 1199
    return-void
.end method

.method public g()V
    .locals 4

    .prologue
    .line 1202
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->r:Lcom/instagram/creation/video/mediarecorder/m;

    invoke-virtual {v0}, Lcom/instagram/creation/video/mediarecorder/m;->a()[B

    move-result-object v0

    .line 1203
    const-string v1, "MediaRecorder_IG"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "length: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    array-length v3, v0

    invoke-static {v3}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 1204
    new-instance v1, Lcom/instagram/creation/video/mediarecorder/a;

    sget-object v2, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->b:[B

    array-length v3, v0

    invoke-direct {v1, v2, v3}, Lcom/instagram/creation/video/mediarecorder/a;-><init>([BI)V

    .line 1205
    array-length v2, v0

    invoke-virtual {v1, v0, v2}, Lcom/instagram/creation/video/mediarecorder/a;->a([BI)V

    .line 1209
    invoke-direct {p0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->i()V

    .line 1211
    const/4 v0, 0x1

    invoke-direct {p0, v0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->a(Z)V

    .line 1213
    new-instance v0, Ljava/io/BufferedOutputStream;

    iget-object v2, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->g:Ljava/io/FileOutputStream;

    invoke-direct {v0, v2}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V

    .line 1214
    invoke-virtual {v1, v0}, Lcom/instagram/creation/video/mediarecorder/a;->a(Ljava/io/OutputStream;)Z

    move-result v1

    .line 1217
    :try_start_0
    invoke-virtual {v0}, Ljava/io/BufferedOutputStream;->flush()V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 1221
    :goto_0
    const-string v0, "MediaRecorder_IG"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "write result: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 1222
    invoke-direct {p0}, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->i()V

    .line 1223
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/StabilizedMediaRecorder;->r:Lcom/instagram/creation/video/mediarecorder/m;

    invoke-virtual {v0}, Lcom/instagram/creation/video/mediarecorder/m;->b()V

    .line 1224
    return-void

    .line 1218
    :catch_0
    move-exception v0

    .line 1219
    const-string v0, "MediaRecorder_IG"

    const-string v2, "could not flush video file buffer"

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method

.method public native setAudioEncoder(I)V
.end method

.method public native setAudioSource(I)V
.end method

.method public native setCamera(Landroid/hardware/Camera;)V
.end method

.method public native setOutputFormat(I)V
.end method

.method public native setVideoEncoder(I)V
.end method

.method public native setVideoFrameRate(I)V
.end method

.method public native setVideoSize(II)V
.end method

.method public native setVideoSource(I)V
.end method
